<!DOCTYPE html>
<html>
<head>
	<title>订单详情</title>
	<include file='public/head'></include>
	<style>
		.layui-legend-size{font-size:14px !important;}
		.layui-nopadding{padding:0 !important;}
		.layui-overflow{overflow:auto;}
		.layui-nomargin{margin: 0 !important;}
		.layui-bottom{border-bottom:1px solid rgb(226, 226, 226);}
		.layui-input{height:30px !important; }
		.layui-form-search-item .layui-inline{margin-bottom: 5px;}
		.layui-form-search-item label{margin-left: 15px;}
		.layui-table-page {padding: 7px 0px 0px;}
		.layui-field-padding{border-width: 1px;padding:0 0 5px 10px;}
	</style>
</head>
<body>
	<div class="layui-card">
		<button type="button" class="layui-btn" onclick="javascript:history.back(-1);"><i class="layui-icon layui-icon-return"></i> 返回</button>
		<div class="layui-card">
			<!-- 进度图 -->
		</div>
		<br>
		<div class="layui-card">
			<!-- 状态 -->
			<h3>当前订单状态：{$order->order_status_china}</h3>
			<div align="right">
				<?php
					if($order->order_status == 1 || $order->order_status == 2){
						?>
						<button class="layui-btn layui-btn-primary consginee-btn" data-id="{$order->order_num}">修改收货人信息</button>
						<!-- <a href="{:cmf_plugin_url('Order://admin_index/orderGoodsEdit')}?order_num={$order->order_num}" class="layui-btn layui-btn-primary">修改商品信息</a> -->
						<?php
					}
					if($order->order_status == 1){
						?>
						<!-- <a href="{:cmf_plugin_url('Order://admin_index/moneyEdit')}?order_num={$order->order_num}" class="layui-btn layui-btn-primary" >修改费用信息</a> -->
						<button class="layui-btn layui-btn-primary money-btn" data-id="{$order->order_num}">修改费用信息</button>
						<button onclick="orderClose('{$order->order_num}')" class="layui-btn layui-btn-primary">关闭订单</button>
						<?php
					}
					if($order->order_status == 2){
						?>
						<!-- <a href="{:cmf_plugin_url('Order://admin_index/orderCancel')}?order_num={$order->order_num}" class="layui-btn layui-btn-primary" >取消订单</a> -->
						<?php
					}
					if($order->order_status == 3 || $order->order_status == 4){
						?>
						<!-- <a href="" class="layui-btn layui-btn-primary" >订单跟踪</a> -->
						<button class="layui-btn layui-btn-primary logistics-btn" data-id="{$order->order_num}">订单跟踪</button>
						<?php
					}
					if($order->order_status == 4){
						?>
						<a href="" class="layui-btn layui-btn-primary" >发送站内信</a>
						<?php
					}
					if($order->order_status == 5){
						?>
<!--						<a href="" class="layui-btn layui-btn-primary" >删除订单</a>-->
						<?php
					}
				?>
				<button class="layui-btn layui-btn-primary remark-btn" data-id="{$order->order_num}">备注订单</button>
			</div>
		</div>
		<br>
		<div class="layui-card">
			<fieldset class="layui-elem-field layui-field-title layui-field-padding">
				<legend class="layui-legend-size">基本信息</legend>
				{$order_html}
			</fieldset>
		</div>
		<br>
		<div class="layui-card">
			<fieldset class="layui-elem-field layui-field-title layui-field-padding">
				<legend class="layui-legend-size">收货人信息</legend>
				{$order_consignee_html}
			</fieldset>
		</div>
		<br>
		<div class="layui-card">
			<fieldset class="layui-elem-field layui-field-title layui-field-padding">
				<legend class="layui-legend-size">商品信息</legend>
				<table  class="layui-table layui-nomargin" >
					<!-- 表格头 -->
					<thead>
						<tr>
							<php>
								//输出表格头
								echo $goods_table->getHeader();
							</php>
						</tr>
					</thead>
					<!-- 表格头 -->
					<volist name="goods" id="vo">
						<tr>
							<php>
								echo $goods_table->createHtml($vo);
							</php>
						</tr>
					</volist>
				</table>
			</fieldset>
		</div>
		<br>
		<div class="layui-card">

		</div>
	</div>
<include file='public/scripts'></include>
<script type="text/javascript">
	//修改金额
	$('.money-btn').on('click',function(){
		let id = $(this).data('id');
		let url = "{:cmf_plugin_url('order://admin_index/moneyEdit')}?order_num="+id;
		layer.open({
			type: 2//基本层类型  0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
			,title: '查询物流'//层的标题
			,shadeClose: true//是否点击遮罩关闭
			,shade: 0.8//遮罩
			,area: ['100%', '50%']//宽高
			,btn:['提交','关闭']//弹框按钮
			,fixed:false//固定
			,content: url //iframe的url
			,yes:function(index, layero){
            //子页面的请求操作都放子页面
                var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：
                iframeWin.tijiao();
			}
			,btn2:function(index, layero){
			}
		});
	})
	
	//修改收货人信息
	$('.consginee-btn').on('click',function(){
		let id = $(this).data('id');
		let url = "{:cmf_plugin_url('order://admin_index/consigneeEdit')}?order_num="+id;
		layer.open({
			type: 2//基本层类型  0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
			,title: '查询物流'//层的标题
			,shadeClose: true//是否点击遮罩关闭
			,shade: 0.8//遮罩
			,area: ['50%', '50%']//宽高
			,btn:['提交','关闭']//弹框按钮
			,fixed:false//固定
			,content: url //iframe的url
			,yes:function(index, layero){
            //子页面的请求操作都放子页面
                var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：
                iframeWin.tijiao();
			}
			,btn2:function(index, layero){
			}
		});
	})
	//订单追踪
	$('.logistics-btn').on('click',function(){
		let id = $(this).data('id');
		let url = "{:cmf_plugin_url('order://admin_index/orderTrace')}?order_num="+id;
		layer.open({
			type: 2//基本层类型  0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
			,title: '查询物流'//层的标题
			,shadeClose: true//是否点击遮罩关闭
			,shade: 0.8//遮罩
			,area: ['50%', '100%']//宽高
			,btn:['关闭']//弹框按钮
			,fixed:false//固定
			,content: url //iframe的url
			// ,yes:function(index, layero){
   //          //子页面的请求操作都放子页面
   //              var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：
   //              iframeWin.tijiao();
			// }
			// ,btn2:function(index, layero){
			// }
		});
	})
	//添加备注
	$('.remark-btn').on('click',function(){
		let id = $(this).data('id');
		let url = "{:cmf_plugin_url('order://admin_index/orderRemark')}?order_num="+id;
		layer.open({
			type: 2//基本层类型  0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）
			,title: '添加备注'//层的标题
			,shadeClose: true//是否点击遮罩关闭
			,shade: 0.8//遮罩
			,area: ['50%', '50%']//宽高
			,btn:['提交','关闭']//弹框按钮
			,fixed:false//固定
			,content: url //iframe的url
			,yes:function(index, layero){
            //子页面的请求操作都放子页面
                var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：
                iframeWin.tijiao();
			}
			,btn2:function(index, layero){
			}
		});
	})
	//关闭
	function orderClose(id){
		layer.confirm('确认关闭?', {icon: 3, title:'提示'}, function(index){
			let url = "{:cmf_plugin_url('Order://admin_index/orderClose')}";
			$.ajax({
	            url:url,
				type:'post',
	            data:{id:id},
				success:function(data){
					if (data.code == 1) {
						layer.msg(data.msg,{icon:1,time:1500},function(){
							window.location.reload();
							layer.closeAll();
						});
					} else {
						layer.msg(data.msg,{icon:2,time:1500});
					}
				},
				error:function()
				{
					layer.msg('系统错误',{icon:2,time:1500});
				}		            
        	})
		  layer.close(index);
		});			
	}	
</script>
</body>
</html>